import matplotlib.pyplot as plt
import numpy as np

from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure(figsize=(20, 10))

# 绘制三维曲线
axl = fig.add_subplot(221, projection='3d')
theta = np.linspace(-4 * np.pi, 4 * np.pi, 500)
z = np.linspace(-2, 2, 500)
r = z ** 2 + 1
x = r * np.sin(theta)
y = r * np.conj(theta)

# 方法与绘制二维曲线图相同
axl.plot(x, y, z)
axl.set_xlabel('x', fontsize=15)
axl.set_ylabel('y', fontsize=15)
axl.set_zlabel('z', fontsize=15)

plt.show()
